package com.kuang.pet.service;

import com.kuang.bascic.service.BaseServiceImpl;
import com.kuang.pet.domain.Pet;
import com.kuang.pet.domain.PetDetail;
import com.kuang.pet.mapper.PetDetailMapper;
import com.kuang.pet.mapper.PetMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class PetServiceImpl extends BaseServiceImpl<Pet> implements PetService {
    @Autowired
    private PetMapper petMapper;
    @Autowired
    private PetDetailMapper petDetailMapper;

    @Override
    public void addDepartment(Pet pet) {
       //保存宠物  ，返回新增主键
        petMapper.addDepartment(pet);
        // 保存宠物详情
        PetDetail detail = pet.getDetail();
        detail.setPet_id(pet.getId());
        petDetailMapper.addDepartment(detail);
    }

    @Override
    public void onsale(Long[] ids) {
        petMapper.onsale(ids);

    }

    @Override
    public Pet detil(Long id) {
       return petMapper.detil(id);
    }
}
